/************
 * Nautilus *
 ************/
// based css:
// https://gitlab.gnome.org/GNOME/nautilus/blob/master/src/resources/css/Adwaita.css
// hard-coded css:
// https://gitlab.gnome.org/GNOME/nautilus/blob/master/src/resources/css/nautilus.css

%nautilus_bg_img {
  background-image: -gtk-scaled(url("assets/background-img-bottom#{$asset_suffix}#{$asset_color}.png"),
                                url("assets/background-img-bottom#{$asset_suffix}#{$asset_color}@2.png"));
  background-repeat: no-repeat;
  background-position: top right;
}

%headerbar_bg_img {
  background-image: -gtk-scaled(url("assets/background-img-top#{$asset_suffix_light}#{$asset_color}.png"),
                                url("assets/background-img-top#{$asset_suffix_light}#{$asset_color}@2.png"));
  background-repeat: no-repeat;
  background-position: bottom right;
}

%nautilus_none_img {
  background-image: none;
}

%headerbar_none_img {
  background-image: none;
}

%pathbar_box_button {
  margin: 0;
  padding: 0 6px;
  min-height: $medium_size;
  border-image: radial-gradient(circle closest-corner at center calc(100% - 1px),
                                $primary_color 0%,
                                transparent 0%)
                                0 0 0 / 0 0 0;

  &:checked, &:active {
    color: $titlebar_fg_color;
    background-color: transparent;
    border-image: radial-gradient(circle closest-corner at center calc(100% - 1px),
                                  $primary_color 100%,
                                  transparent 0%)
                                  0 0 2 / 0 0 2px;
  }

  &:checked:backdrop, &:active:backdrop {
    color: $titlebar_secondary_fg_color;
    border-image: radial-gradient(circle closest-corner at center calc(100% - 1px),
                                  $titlebar_disabled_fg_color 100%,
                                  transparent 0%)
                                  0 0 2 / 0 0 2px;
  }
}

%width_maximized_button {
  margin: 0;
  color: $inverse_fg_color;
  background-color: transparent;
  border-image: none;

  &:hover {
    color: $inverse_fg_color;
    background-color: rgba($inverse_fg_color, 0.08);
  }

  &:active {
    color: $inverse_fg_color;
    background-color: rgba($inverse_fg_color, 0.12);
  }

  &:checked {
    color: $titlebar_secondary_fg_color;
    background-color: $titlebar_bg_color;
    box-shadow: inset 0 0 0 9999px $row_fill_color;
    border-image: none;
    background-image: radial-gradient(circle farthest-corner at center,
                                      $row_fill_color 10%,
                                      transparent 0%);
    background-size: 0% 0%;
  }

  &:checked:hover {
    color: $titlebar_fg_color;
    background-color: $titlebar_bg_color;
  }

  &:disabled {
    color: $inverse_disabled_fg_color;
    background-color: transparent;
  }

  &:checked:disabled {
    color: $titlebar_disabled_fg_color;
    background-color: $titlebar_bg_color;
  }

  &:backdrop {
    color: $inverse_secondary_fg_color;
    background-color: transparent;
    &:hover {
      color: $inverse_secondary_fg_color;
      background-color: rgba($inverse_secondary_fg_color, 0.08);
    }
  }

  &:checked:backdrop, &:active:backdrop {
    color: $titlebar_hint_fg_color;
    background-color: $titlebar_bg_color;
    border-image: none;
  }
}

%width_maximized_linked_button {
  margin: 0;
  color: $inverse_fg_color;
  background-color: transparent;
  border-image: none;

  &:hover {
    color: $inverse_fg_color;
    background-color: rgba($inverse_fg_color, 0.08);
  }

  &:active {
    color: $inverse_fg_color;
    background-color: rgba($inverse_fg_color, 0.12);
  }

  &:checked {
    color: $inverse_fg_color;
  }

  &:disabled {
    color: $inverse_disabled_fg_color;
    background-color: transparent;
  }

  &:checked:disabled {
    color: $titlebar_disabled_fg_color;
    background-color: $titlebar_bg_color;
  }
}

%nautilus_pathbar_button {
  background-color: $primary_color;
  color: $inverse_fg_color;
  transition: none;
  box-shadow: none;
  border-radius: 0;
  outline-offset: -6px;
  -gtk-outline-radius: $square_radius - 2px;

  &:hover {
    color: gtkalpha($inverse_fg_color, 0.75);
    background-color: $primary_color;
    transition: $longer_transition;
  }

  &:active {
    border-image-source: if($compact == 'false', $header_path_button_border, $header_path_button_border_compact);
    border-image-width: 8px 16px 8px 16px;
    border-image-slice: 8 16 8 16;
    border-image-repeat: stretch;
    transition: $longer_transition, background-size 0, border-image 0;
    color: $titlebar_secondary_fg_color;
    background-color: $titlebar_bg_color;
    box-shadow: none;
    background-image: none;
  }

  &:first-child {
    border-radius: $square_radius 0 0 $square_radius;

    &:active {
      box-shadow: none;
      background-image: none;
      border-image-source: if($compact == 'false', $stack_switcher_firstbutton_border, $stack_switcher_firstbutton_border_compact);
    }
  }

  &:last-child {
    border-radius: 0 $square_radius $square_radius 0;

    &:active {
      box-shadow: none;
      background-image: none;
      border-image-source: if($compact == 'false', $stack_switcher_lastbutton_border, $stack_switcher_lastbutton_border_compact);
    }
  }

  &:only-child { border-radius: $square_radius; }

  &:disabled { color: $inverse_disabled_fg_color; }

  &:backdrop {
    color: $inverse_secondary_fg_color;
    background-color: rgba($primary_color, 0.75);

    &:disabled { color: $inverse_disabled_secondary_fg_color; }
  }
}

.nautilus-window,
.nautilus-window notebook,
.nautilus-window notebook > stack {
  background-color: $base_color;
  border-radius: 0 0 $windows_radius $windows_radius;
  @extend %nautilus_bg_img;
}

.nautilus-window headerbar {
  @extend %headerbar_bg_img; // Set nautilus background pictures

  .path-bar-box { // Fixed nautilus 3.30 pathbar
    margin: $container_padding 0;
    color: $titlebar_fg_color;
    background-color: transparent;

    button.flat.text-button.toggle,
    button.flat.image-button.text-button.toggle { @extend %pathbar_box_button; }

    .linked.nautilus-path-bar { // for ≥ 3.31.90
      > button {
        margin-top: 0;
        margin-bottom: 0;
        @extend %pathbar_box_button;

        &:not(:only-child):last-child {
          border-image: radial-gradient(circle closest-corner at center calc(100% - 1px),
                                        $primary_color 100%,
                                        transparent 0%)
                                        0 0 2 / 0 0 2px;
        }
      }
    }

    &.width-maximized {
      // color: $inverse_fg_color;
      background-color: transparent;
      border-radius: $square_radius;

      // button.flat.text-button.toggle,
      // button.flat.image-button.text-button.toggle {
      //   padding: 0 6px;
      //   min-height: $small_size + 6px;
      //   border-radius: $square_radius - 2px;
      //   border: 3px solid $primary_color;
      //   @extend %width_maximized_button;
      // }
    }

    // workaround for 3.30.1
    &.background.frame {
      border: none;
      background-color: transparent;
    }
  }
}

// No border radius when window maximized
.nautilus-window.maximized,
.nautilus-window.maximized notebook,
.nautilus-window.maximized notebook > stack { border-radius: 0; }

.nautilus-canvas-item {
  border-radius: $material_radius;
}

.nautilus-canvas-item.dim-label,
.nautilus-list-dim-label {
  color: mix($fg_color, $bg_color, 50%);

  &:selected, &:selected:focus { color: mix($inverse_fg_color, $primary_color, 80%); }
}

.nautilus-desktop.nautilus-canvas-item:not(:selected) {
  // background-color: rgba($black, $lower_opacity);
  color: $inverse_fg_color;
  text-shadow: $shadow_1;
  border-radius: $material_radius;
}

// Toolbar
@keyframes needs_attention_keyframes {
  to { background-color: $fill_color; }
}

.nautilus-operations-button-needs-attention {
  animation: needs_attention_keyframes $longer_duration $standard_curve 2 alternate;
}

.nautilus-operations-button-needs-attention-multiple {
  animation: needs_attention_keyframes $longer_duration $standard_curve 4 alternate;
}

// Floating status bar
.nemo-window,
.nautilus-window {
  .floating-bar {
    @extend %osd;

    min-height: 32px;
    padding: 0;
    border-style: solid solid none;
    border-width: 1px;
    border-color: $border_color;
    border-radius: $windows_radius $windows_radius 0 0;
    background-color: $base_color;
    background-clip: $extra_background_clip;
    transition: $longer_transition, border-width 0;

    &.bottom.left { // axes left border and border radius
      border-left-style: none;
      border-top-left-radius: 0;
      border-bottom-left-radius: $windows_radius;
    }

    &.bottom.right { // axes right border and border radius
      border-right-style: none;
      border-top-right-radius: 0;
      border-bottom-right-radius: $windows_radius;
    }

    button {
      margin: 8px;

      @extend %small_button;
      @extend %simple_flat_button;
    }
  }
}

// Reset maximized nautilus-window floating-bar border-radius
.nautilus-window.maximized .floating-bar {
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

.disk-space-display {
  // border-style: solid;
  // border-width: $buttons_radius;

  &.unknown { background-color: $warning_color; }

  &.used { background-color: $primary_color; }

  &.free { background-color: $divider_color; }
}

// View
// Hide superfluous treeview drop target indication
.nautilus-list-view .view:not(.dnd) {
  // border-bottom: 1px solid $border_color;
}

.documents-entry-tag {
  @extend .entry-tag;
}

// Workaround for the double border of the searchbar since we use a revealer which
// always allocates at least 1 pixel
.nautilus-window {
  searchbar {
    border-top: 1px solid $border_color;
    background-color: rgba($bg_color, 0.65);
  }

  .searchbar-container { margin-top: -1px; }
}

.conflict-row:not(:selected) { background-color: mix($warning_color, $base_color, percentage($lower_opacity)); }

// Icon view
.nautilus-window flowboxchild {
  // > widget > box > .icon-background { background-color: black; }

  > widget > .icon-item-background {
    padding: 4px;
    border-radius: $material_radius;
  }

  &:selected {
    background-color: transparent;

    > widget > .icon-item-background { background-color: $primary_color; }
  }
}

// Batch rename dialog
dialog.background > box.dialog-vbox.vertical > grid.horizontal {
  > scrolledwindow.frame { border-style: none; }

  > box.horizontal:last-child {
    margin: -6px 0 0 -6px;
    border-top: 1px solid $border_color;

    > label { margin: 0 8px; }

    > box > button { border-radius: 0; }
  }
}

// Tweak to fix the messy sizing of the popover menu
.nautilus-window > popover.menu:not(:last-child) {
  padding: 3px;

  > stack > box > box > box {
    margin-top: -6px;

    > box {
      margin-bottom: -6px;

      &.linked { margin-top: 1px; }
    }
  }

  separator { margin-bottom: -2px; }
}

.nautilus-menu-sort-heading {
  // min-height: 26px;
  // padding-left: 5px;
  // padding-right: 5px;
  margin: 1px 3px;
  font-weight: 500;

  &:disabled { color: $hint_fg_color; }
}

// Make operations button circular
.nautilus-window headerbar > revealer > button { @extend %circular_button; }

// Ensure paned separator rendering. See issue #84 for details.
.nautilus-window paned > separator { background-color: $bg_color; }

// Nautilus placessidebar
filechooser,
.nautilus-window {

  &.csd.background, placessidebar list { background-color: transparent; }
  &.csd.background, placessidebar {
    background-color: transparentize($lighter_bg_color, 0.03);
    border-radius: 0 0 $windows_radius $windows_radius; // It also has an effect on nautilus notebook stacks background
  }

  &.maximized placessidebar { border-radius: 0; }
  &.maximized placessidebar.sidebar { background-color: $lighter_bg_color; }

  placessidebar.sidebar {
    background-color: transparent;

    row.sidebar-row {
      transition: none;

      &:hover {
        color: $primary_color;
        background-color: rgba($divider_color, 0.03);
        box-shadow: inset 3px 0 $primary_color;
        image.sidebar-icon { color: $primary_color; }
      }

      &:active { box-shadow: inset 3px 0 $primary_color; }

      &:backdrop { opacity: 0.85; }

      &:selected image.sidebar-icon,
      &:selected:hover image.sidebar-icon { color: $inverse_fg_color; }

      &:selected {

        &:active { box-shadow: none; }

        &:hover {
          box-shadow: none;
          color: $inverse_fg_color;
          background-color: rgba($primary_color, 0.8);
        }
      }
    }
  }
}


/*********
 * gedit *
 *********/
// based css:
// https://git.gnome.org/browse/gedit/tree/gedit/resources/css/gedit.adwaita.css
// hard-coded css:
// https://git.gnome.org/browse/gedit/tree/gedit/resources/css/gedit-style.css

// Only normal state is handle
.open-document-selector-name-label {
  // font-weight: bold;
}

// Only normal state is handle
.open-document-selector-path-label {
  color: $secondary_fg_color;
  font-size: smaller;

  &:selected { color: $inverse_secondary_fg_color; }
}

.gedit-document-panel {
  background-color: $lighter_bg_color;

  // Try to look as the notebook tab close button
  row button.flat {
    margin: 8px;

    @extend %small_button;
  }
}

.gedit-document-panel-group-row:not(:first-child) {
  border-top: 1px solid $border_color;
}

.gedit-side-panel-paned statusbar {
  border-top: 1px solid $border_color;
}

.gedit-search-slider {
  margin: 4px 4px 8px;

  entry {
    &:dir(ltr),
    &:dir(rtl) { // specificity bump
      border-radius: $buttons_radius;

      .gedit-search-entry-occurrences-tag {
        all: unset;
        color: $hint_fg_color;
      }
    }

    $buttons_width: $small_size * 2 + $container_padding * 3;

    &:dir(ltr) {
      margin-right: -$buttons_width;
      padding-right: $buttons_width;

      .gedit-search-entry-occurrences-tag { margin-left: $container_padding; }

      image.right { margin-right: 0; }
    }

    &:dir(rtl) {
      margin-left: -$buttons_width;
      padding-left: $buttons_width;

      .gedit-search-entry-occurrences-tag { margin-right: $container_padding; }

      image.left { margin-left: 0; }
    }

    &.error ~ button {
      color: $inverse_secondary_fg_color;

      &:hover, &:active { color: $inverse_fg_color; }

      &:disabled { color: $inverse_disabled_secondary_fg_color; }
    }
  }

  button {
    border: solid $container_padding transparent;

    @extend %simple_flat_button;

    &:dir(ltr),
    &:dir(rtl) { @extend %small_button; } // specificity bump

    &:last-child:dir(ltr),
    &:not(:first-child):dir(rtl) { margin-left: -$container_padding / 2; }

    &:first-child:dir(rtl),
    &:not(:last-child):dir(ltr) { margin-right: -$container_padding / 2; }
  }
}

frame.gedit-map-frame > border {
  &:dir(ltr) { border-style: none none none solid; }
  &:dir(rtl) { border-style: none solid none none; }
}

paned.titlebar.horizontal { // show border
  headerbar { box-shadow: inset 0 -1px $border_color; }
}

.gedit-side-panel-paned.horizontal {

  // 'file-browser' pane
  > box.vertical > stack > grid.horizontal {
    padding: 3px 3px 0;

    > box.horizontal {  // header-part
      margin: 0 0 2px;

      button.image-button.small-button {
        // FIXME: why does gedit break our geometry everytime?
        padding: 4px;
        border-radius: $buttons_radius;
        -gtk-outline-radius: $buttons_radius;
      }

      button.popup.small-button.toggle {
        padding: 4px;
      }
    }

    > scrolledwindow { // raised widget
      margin: 2px 6px 6px;
      border-radius: $buttons_radius;
      box-shadow: $shadow_1;

      row.activatable { padding: 3px; }
    }
  }
}


/**************
 * Tweak Tool *
 **************/
// hard-coded css:
// https://git.gnome.org/browse/gnome-tweak-tool/tree/data/shell.css

// the sidebar
.tweak-categories {
  // padding: 4px 0;
  // background-color: shade(@theme_bg_color, 0.99);
  background-image: image($lighter_bg_color);

  separator { @extend %hide_separators; }
}

.tweak {
  // padding-top: 3px;
  padding: 3px;

  &.title:hover { box-shadow: none; }
}

.tweak-group-white,
.tweak-white,
.tweak-white:hover {
  // background-color: white;
  background-image: image($base_color);
}

.tweak-startup,
.tweak-startup:hover {
  // background-color: lighter(shade(@theme_bg_color, 0.9));
  background-image: image($base_color);
}

.tweak-group-startup {
  // background-color: @view_separators;
  background-image: image($base_color);
  border: 1px solid $border_color;
}

//
// Workaround for 3.26
//

row#Focus,
row#StaticWorkspaceTweak, // for 3.26.0
row#dynamic-workspaces,
row#PrimaryWorkspaceTweak, // for 3.26.0
row#workspaces-only-on-primary {
  padding: 0;
  border: 1px solid $border_color;

  row:not(:last-child) { border-bottom: 1px solid $border_color; }

  &.tweak > list { margin-top: -3px; }
}

// Add more spaces between title and list
row#Focus,
row#PrimaryWorkspaceTweak, // for 3.26.0
row#workspaces-only-on-primary {
  margin-top: 4px;
}


/***********
 * Builder *
 ***********/
// based css for 3.22:
// https://git.gnome.org/browse/gnome-builder/tree/data/theme?h=gnome-builder-3-22
// based css for 3.24:
// https://git.gnome.org/browse/gnome-builder/tree/data/theme?h=gnome-builder-3-24
// based css for 3.26:
// https://git.gnome.org/browse/gnome-builder/tree/data/themes?h=gnome-builder-3-26

// Layout tab and tab bar tweaks
// The following makes the layout stack header look similar to a tab bar.
layouttabbar {
  border-bottom: 1px solid $border_color;
  background-color: $bg_color;

  button { @extend %flat_button; }

  > box > button {
    margin: (40px - $medium_size) / 2 0;
    // border-radius: 0;
  }
}

layouttab {
  margin: 0 8px; // not working
  border-style: none solid;
  border-width: 1px;
  border-color: $border_color;
  box-shadow: inset 0 -2px $primary_color;
  background-color: $base_color;

  separator.vertical { margin: 8px 4px; }

  button {
    &.text-button, &.image-button, & {
      margin-top: 8px;
      margin-bottom: 8px;
      padding: 0 4px;
    }
  }

  // Close button styling for layouttab.
  // > box > button.close { @extend %circular_button; }
}

layout {
  border: 1px solid $border_color;
  -PnlDockBin-handle-size: 1;
}

entry.search-missing {
  background-color: $error_color;
  color: $inverse_fg_color;
}

// tweak icons for treeviews
window.workbench treeview.image {
  color: $secondary_fg_color;

  &:selected { color: $inverse_secondary_fg_color; }
}

popover.popover-selector list {
  padding: 8px - 2px;

  row {
    border-radius: $buttons_radius;

    image {
      &:dir(ltr) { margin-right: 6px; }
      &:dir(rtl) { margin-left: 6px; }
    }

    .accel {
      &:dir(ltr) { margin-left: 6px; }
      &:dir(rtl) { margin-right: 6px; }
    }
  }
}

omnibar {
  &.linked:not(.vertical) entry { border-radius: $buttons_radius; }

  &:not(:hover):not(:active) entry { color: $secondary_fg_color; }
}

popover.omnibar list row:not(:last-child) {
  border-bottom: 1px solid $border_color;
}

entry.preferences-search {
  @extend %entry.flat;

  box-shadow: inset 0 -1px $border_color;
  background-color: $base_color;

  // doesn't work properly
  // &:dir(ltr) { border-right: 1px solid $border_color; }
  // &:dir(rtl) { border-left: 1px solid $border_color; }
}

preferences stacksidebar.sidebar {
  list { background-color: $lighter_bg_color; }

  &:dir(ltr),
  &:dir(rtl) { list { border-style: none; }}

  list separator { @extend %hide_separators; }
}

preferences > box > box {
  &:dir(ltr) { border-right: 1px solid $border_color; }
  &:dir(rtl) { border-left: 1px solid $border_color; }
}

popover.messagepopover {
  &.background { padding: 0; }

  .popover-action-area button {
    @extend %simple_flat_button;

    padding: 8px 16px;
    border-top: 1px solid $border_color;
    border-radius: 0;

    &:first-child { border-bottom-left-radius: $buttons_radius; }

    &:last-child { border-bottom-right-radius: $buttons_radius; }
  }

  .popover-content-area { margin: 16px; }
}

popover.transfers list {
  background-color: transparent;

  row:not(:first-child) { border-top: 1px solid $border_color; }

  row > box { padding: 10px; }
}

dockbin {
  border: 1px solid $border_color;
  -PnlDockBin-handle-size: 1;
}

dockpaned {
  border: 1px solid $border_color;
}

eggsearchbar box.search-bar {
  padding: 0 8px;
  border-bottom: 1px solid $border_color;
  background-color: $bg_color;
}

docktabstrip {
  padding: 0 8px;
  border-bottom: 1px solid $border_color;
  background-color: $bg_color;
}

docktab {
  transition: $longer_transition,
              background-size 0,
              background-image 0;
  min-height: $small_size;
  min-width: $small_size;
  margin-bottom: -1px;
  padding: $container_padding 6px;

  outline-offset: -6px;

  border-width: 1px;         // for reorderable tabs
  border-color: transparent; //

  background-image: radial-gradient(circle farthest-corner at center,
                                    $primary_color 10%,
                                    transparent 0%);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0% 0%;

  color: $secondary_fg_color;
  font-weight: 500;

  &:hover {
    box-shadow: inset 0 -2px $track_color;
    color: $fg_color;
  }

  &:checked {
    transition: $longer_transition,
                background-size $longer_duration $deceleration_curve,
                background-image $longer_duration + $ripple_duration $deceleration_curve;
    box-shadow: inset 0 -2px $primary_color;
    background-image: radial-gradient(circle farthest-corner at center,
                                      transparent 10%,
                                      transparent 0%);
    background-size: 1000% 1000%;
    color: $fg_color;
  }
}

dockoverlayedge {
  background-color: $bg_color;

  docktabstrip {
    padding: 0;
    border: none;
  }

  &.left-edge docktab {
    &:hover { box-shadow: inset -2px 0 $track_color; }
    &:checked { box-shadow: inset -2px 0 $primary_color; }
  }

  &.right-edge docktab {
    &:hover { box-shadow: inset 2px 0 $track_color; }
    &:checked { box-shadow: inset 2px 0 $primary_color; }
  }
}

pillbox {
  background-color: $bg_color;
  border-radius: $buttons_radius;
}

buildperspective row {
  // padding: 10px;
}

layoutpane entry.search {
  @extend %entry.flat;

  box-shadow: inset 0 -1px $border_color;
  background-color: $base_color;
}

editortweak entry.search {
  @extend %entry.flat;

  margin-bottom: -1px;
  box-shadow: none;
}

//
// let's tweak hard-coded elements
//

.gb-search-entry-occurrences-tag {
  box-shadow: none;
  background-color: transparent;
}

// Keep search bar and layouttab height in sync.
// layouttabbar > box,
// eggsearchbar > revealer > box,
docktabstrip {
  min-height: 39px;
}

eggsearchbar entry {
  // min-height: 24px;
}

window.workbench preferences preferencesgroup list entry {
  // background: none;
  // min-height: 0px;
  padding-top: 8px;
  padding-bottom: 8px;
}

button.run-arrow-button {
  // min-width: 12px;
  padding-left: ($medium_size - 16px) / 2;
  padding-right: ($medium_size - 16px) / 2;
}

//
// Additional styles for 3.26
//

button.dzlmenubutton image {
  min-width: $medium_size - 6px;

  &.arrow { min-width: $medium_size - 9px; }
}

button.dzlmenubuttonitem {
  color: $fg_color;
  font-weight: normal;

  &:disabled { color: $disabled_fg_color; }
}

idelayoutstackheader {
  border-bottom: 1px solid $border_color;

  button:checked { color: $fg_color; }
}

// utilities stack switcher
ideeditorutilities > dzldockpaned > box > stackswitcher {
  padding: 8px 0;
  background-color: $bg_color;

  &:dir(ltr) { border-right: 1px solid $border_color; }

  &:dir(rtl) { border-left: 1px solid $border_color; }

  button {
    border-radius: 0;
    outline-offset: -6px;
    box-shadow: none;
    background-color: transparent;

    &:active {
      background-image: radial-gradient(circle farthest-corner at center,
                                        rgba($primary_color, 0.7) 10%,
                                        transparent 0%);
    }

    &:checked {
      background-color: transparent;
      color: $fg_color;
    }

    &:dir(ltr) {
      margin-right: -1px;

      &:hover { box-shadow: inset -2px 0 $track_color; }

      &:active,
      &:checked { box-shadow: inset -2px 0 $primary_color; }
    }

    &:dir(rtl) {
      margin-left: -1px;

      &:hover { box-shadow: inset 2px 0 $track_color; }

      &:active,
      &:checked { box-shadow: inset 2px 0 $primary_color; }
    }
  }
}

// buildui panel
ideeditorsidebar notebook header {
  background: transparent;
}

popover.messagepopover {
  // padding: 0;

  list {
    border: 1px solid $border_color;

    row:not(:last-child) { border-bottom: 1px solid $border_color; }
  }
}


/**********
 * Photos *
 **********/
// based css:
// https://git.gnome.org/browse/gnome-photos/tree/data/Adwaita.css

GdMainIconView.content-view {
  -GdMainIconView-icon-size: 48;

  // Make spinner visible on both dark and bright backgrounds w/o making
  // it look ugly/weird.
  // &.cell:active { color: $hint_fg_color; }
}

.documents-counter {
  margin: 8px;
  border-radius: $circular_radius;
  box-shadow: $shadow_2;
  background-color: $accent_color;
  color: $inverse_fg_color;
  font-weight: bold;
}

.photos-entry-tag {
  @extend .entry-tag;
}

.documents-scrolledwin.frame {
  border-style: none;

  frame.content-view > border { border-style: none; }
}

.photos-icon-bg {
}

.photos-fade-in {
  opacity: 1;
  transition: opacity $shorter_duration $deceleration_curve;
}

.photos-fade-out {
  opacity: 0;
  transition: opacity $shorter_duration $deceleration_curve;
}

.photos-collection-icon {
}

overlay grid.horizontal > revealer > scrolledwindow.frame {
  &:dir(ltr) { border-style: none none none solid; }
  &:dir(rtl) { border-style: none solid none none; }
}


/*********
 * Music *
 *********/
// hard-coded css:
// https://git.gnome.org/browse/gnome-music/tree/data/application.css

.side-panel:dir(ltr) {
  // border-width: 0 1px 0 0;
  border-style: solid;
  border-color: $border_color;
}

.side-panel:dir(rtl) {
  // border-width: 0 0 0 1px;
  border-style: solid;
  border-color: $border_color;
}

.side-panel .view {
  // background-color: mix(@theme_fg_color, @theme_bg_color, 0.9);
  background-image: image($lighter_bg_color);

  &:hover { background-image: image(mix($fg_color, $lighter_bg_color, percentage(0.05))); }
}

.side-panel .view:selected {
  // background-color: mix(@theme_fg_color, @theme_bg_color, 0.5);
  background-image: image($primary_color);

  &:hover { background-image: image(mix($inverse_fg_color, $primary_color, percentage(0.05))); }
}

.songs-list {
  // box-shadow: inset 0 -1px shade(@borders, 1.30);
  // background-color: @theme_bg_color;

  &:hover { background-image: image($row_fill_color); }
}

frame.documents-dropdown {
  @extend toolbar.osd;

  margin: 8px;

  > border { border: none; }
}

box.vertical > revealer > toolbar.search-bar {
  border-bottom: 1px solid $border_color;
  background-clip: border-box; // avoid black border

  button > widget {
    -gtk-icon-source: -gtk-icontheme("pan-down-symbolic");
    // -GtkArrow-arrow-scaling: 1;
  }
}


 /**************
  * Gnome-Logs *
  **************/

// titles inside the button!?
headerbar > button.flat.popup.title-menu-button.toggle {

  > grid {
    .title {
      margin: -3px 0;
      padding: 2px 4px 0;
      font-size: 90%;
    }
    .subtitle {
      margin: -3px 0;
      padding: 0 4px 2px;
      font-size: 80%;
    }
  }
}

window.background > box.vertical box.horizontal {

  list.categories { border-radius: 0 0 0 $windows_radius; } // side-pane

  > box.vertical > scrolledwindow > viewport.frame > list { // right-pane

    > separator {
      background-color: transparent; // hide single-line separators

      &.compressed-rows-group-separator { // use opaque colour
        background-image : image($base_color);
      }
    }

    // > 3.25.90
    row.event.activatable {

      label.compressed-entries-label { // hard-coded background-color?
        background-image: image($suggested_color);
        color: $inverse_fg_color;
        font-weight: 700;
      }

      &.compressed-row {
        background-image: image(darken($bg_color, 3%));
        color: darken($fg_color, 20%);

        &:hover {
          background-image: image(mix($fg_color, $bg_color, 5%));
          color: $fg_color;
        }

        &:active {
          &, &:focus {
            background-image: image(mix($fg_color,
                                        $bg_color, 10%));
            color: $fg_color;
            animation: none;
          }
        }

        &.popover-activated-row {
          background-color: $primary_color;
          color: $inverse_fg_color;
        }

        &-header {
          background-image: image($base_color);
          background-color: $base_color; // stop highlighting
          color: $primary_color;
          transition: none;
          animation: none;

          &:hover {
            background-color: $divider_color;
            color: $primary_color;
          }

          &:active, &:checked {
            &, &:focus {
              background-color: $track_color;
              background-image: image($base_color);
            }
          }

          label.compressed-entries-label {
            background-image: image($primary_color);
            color: $inverse_fg_color;
          }
        }
      }
    }
  }
}


 /**********************
  *  Gnome Tweak Tool  *
  **********************/

// sidebar on gnome tweak
.tweak-categories { border-radius: 0 0 0 $windows_radius; }

.tweak-titlebar-right,
dialog.csd > headerbar.titlebar { > switch { margin: 12px 0; } }


 /************************
  * Gnome Control Center *
  ************************/

// users section

// stack > box.vertical > widget > overlay grid.horizontal > stack {
//   > button.toggle { margin: 8px 6px; } // Show the button shadow completely
// }

box.horizontal.titlebar > headerbar > stack > box.vertical {
  > .title { margin: 0; }
  > .subtitle { margin: -3px 0; }
}

dialog.background.csd {
  > headerbar.titlebar {

    > label:not(.title):not(.subtitle) {
      font-weight: 700;
    }
  }
}

window.background.csd > stack {
  border-radius: 0 0 $windows_radius $windows_radius;
}

stack.background { background: none; }

window.background.csd {
  > headerbar.titlebar { // gnome 3.32
    > box.horizontal > separator.sidebar,
    > hdyleaflet > separator.sidebar {
      border-right-style: none;
      background: none;
      min-width: 0;
    }
  }

  > box.horizontal > separator.sidebar,
  > hdyleaflet > separator.sidebar {
    background: none;
    min-width: 0;
  }
}

// > 3.25.90
.background.csd scrolledwindow.view {
  background-color: $base_color;
  border-bottom-left-radius: $windows_radius;

  > viewport.frame > stack {
    background-color: transparent;

    > list { // left-pane
      background-color: transparent;

      > row.activatable:not(:hover):not(:active):not(:selected) {
        background-color: transparent;
      }
    }
  }
}


/************************
 * Gnome system monitor *
 ************************/
window#gnome-system-monitor.background.csd {
  stack {
    background-color: $base_color;
    border-radius: 0 0 $windows_radius $windows_radius;

    scrolledwindow {
      treeview.view {
        background-color: transparent;
        @extend %view;
      }
    }
  }
}

/******************
 * Gnome terminal *
 ******************/
terminal-window {
  > box.vertical > notebook.terminal-notebook {
    > terminal-screen-container {
      > box.horizontal > vte-terminal.terminal-screen {
        padding: 0;
        border-radius: 0 0 $windows_radius $windows_radius;
      }
    }
  }

  &.background.csd.maximized { border-radius: 0 0 $windows_radius $windows_radius; } // Fixed gnome 3.32 issue: Unable to restore window size after maximization
}

/*********
 * To Do *
 *********/
taskrow {
  transition: $shorter_transition;
  margin: 0 -8px;

  &:hover { transition: none; }

  label { margin: 0 8px; }

  image { min-width: 16px; }
}

task-list-view > box > revealer > box > button {
  margin: (12px * 2 - $medium_size) / 2;
}


/*******
 * eog *
 *******/
#eog-thumb-nav {
  scrolledwindow { border-top: none; }

  button { -gtk-outline-radius: $buttons_radius; }
}


/*************
 * Evolution *
 *************/
frame.taskbar > border { border-style: solid none none; }

box.vertical > paned.horizontal notebook widget .frame { border-style: none; }


/********
 * gitg *
 ********/
frame.commit-frame > border { border-style: solid none none; }


/**************
 * Characters *
 **************/
box.dialog-vbox scrolledwindow.related { border: 1px solid $border_color; }

list.categories { background-image: image($lighter_bg_color); }


/*********
 * Boxes *
 *********/
.transparent-bg + stack overlay > label {
  min-height: 24px;
  padding: 0 4px;
  border-radius: $material_radius;
  background-color: rgba($black, $lower_opacity);
  color: $inverse_fg_color;
}


/**************
 * Calculator *
 **************/
button.title label { min-height: $medium_size; }


/*********
 * Geary *
 *********/
// fix a issue that separator seems double
.geary-titlebar-left {
  &:dir(ltr) {
    margin-right: 5px;
    padding-right: 0;
  }

  &:dir(rtl) {
    margin-left: 5px;
    padding-left: 0;
  }

  > separator { background-color: rgba($black, 0.05); }
}

.geary-titlebar-right {
  &:dir(ltr) { margin-left: -5px; }

  &:dir(rtl) { margin-right: -5px; }
}
